<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <style>
    .box1 {
      width: 200px;
      height: 100px;
      background-color: red;
      margin-bottom: 10px;
      /* 下外边距为 10px */
    }

    .box2 {
      width: 200px;
      height: 100px;
      background-color: green;
      margin-top: 10px;
      /* 上外边距为 10px */
    }
  </style>

  <div class="box1"></div>
  <div class="box2"></div>
</body>

</html>